home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / wwais103 / sources.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  5.5 KB  |  180 lines

  1. VERSION 2.00
  2. Begin Form sources_form 
  3.    BackColor       =   &H00808080&
  4.    Caption         =   "WAIS Sources"
  5.    ClientHeight    =   2985
  6.    ClientLeft      =   1305
  7.    ClientTop       =   3240
  8.    ClientWidth     =   7365
  9.    Height          =   3390
  10.    Left            =   1245
  11.    LinkMode        =   1  'Source
  12.    LinkTopic       =   "Form2"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   2985
  16.    ScaleWidth      =   7365
  17.    Top             =   2895
  18.    Width           =   7485
  19.    Begin CommandButton src_delete 
  20.       Caption         =   "&Delete"
  21.       Height          =   375
  22.       Left            =   6360
  23.       TabIndex        =   4
  24.       Top             =   2520
  25.       Width           =   855
  26.    End
  27.    Begin CommandButton src_change 
  28.       Caption         =   "&Change"
  29.       Height          =   375
  30.       Left            =   5400
  31.       TabIndex        =   5
  32.       Top             =   2520
  33.       Width           =   855
  34.    End
  35.    Begin CommandButton src_add 
  36.       Caption         =   "&Add"
  37.       Height          =   375
  38.       Left            =   4440
  39.       TabIndex        =   3
  40.       Top             =   2520
  41.       Width           =   855
  42.    End
  43.    Begin CommandButton add_ok 
  44.       Caption         =   "&OK"
  45.       Height          =   375
  46.       Left            =   1080
  47.       TabIndex        =   1
  48.       Top             =   2520
  49.       Width           =   855
  50.    End
  51.    Begin CommandButton src_use 
  52.       Caption         =   "&Use"
  53.       Height          =   375
  54.       Left            =   120
  55.       TabIndex        =   2
  56.       Top             =   2520
  57.       Width           =   855
  58.    End
  59.    Begin ListBox s_source_list 
  60.       BackColor       =   &H00FFFFC0&
  61.       FontBold        =   0   'False
  62.       FontItalic      =   0   'False
  63.       FontName        =   "Terminal"
  64.       FontSize        =   9
  65.       FontStrikethru  =   0   'False
  66.       FontUnderline   =   0   'False
  67.       Height          =   2190
  68.       Left            =   120
  69.       TabIndex        =   0
  70.       TabStop         =   0   'False
  71.       Top             =   240
  72.       Width           =   7095
  73.    End
  74.    Begin Label Label1 
  75.       BackColor       =   &H00808080&
  76.       Caption         =   "To revise    sources"
  77.       Height          =   375
  78.       Left            =   3360
  79.       TabIndex        =   6
  80.       Top             =   2520
  81.       Width           =   975
  82.    End
  83. Sub add_ok_Click ()
  84.     mousepointer = HOURGLASS
  85.     s_source_list_dblclick
  86.     sources_form.Hide
  87. End Sub
  88. Sub Form_Load ()
  89.     z = DoEvents()
  90.     If sources_loaded Then
  91.         Exit Sub
  92.     End If
  93.     Open "wais.src" For Input As 2
  94.     x = 0
  95.     While Not EOF(2)
  96.         Line Input #2, source$
  97.         c = 1
  98.         While c <> 0
  99.             c = InStr(source$, Chr$(9))
  100.             If c > 0 Then
  101.                 Mid$(source$, c, 1) = " "
  102.             End If
  103.         Wend
  104.         c1 = InStr(source$, " ")
  105.         s_database(x) = Mid$(source$, 1, c1 - 1)
  106.         c2 = InStr(c1 + 1, source$, " ")
  107.         s_port(x) = Val(Mid$(source$, c1 + 1, c2 - c1))
  108.         c3 = InStr(c2 + 1, source$, " ")
  109.         s_service(x) = Mid$(source$, c2 + 1, c3 - c2 - 1)
  110.         s_source_list.AddItem Right$(source$, Len(source$) - c3)
  111.         x = x + 1
  112.     Wend
  113.     Close (2)
  114.     sources_loaded = True
  115.     mousepointer = DEFAULT
  116. End Sub
  117. Sub Form_Paint ()
  118.     mousepointer = DEFAULT
  119. End Sub
  120. Sub s_source_list_dblclick ()
  121.     Dim x As Integer
  122.     Dim src As Integer
  123.     Dim ssrc As Integer
  124.     If s_source_list.listindex > -1 Then
  125.         src = question_form.source_list.listcount
  126.         ssrc = s_source_list.listindex
  127.         For x = 0 To src - 1
  128.             If src_port(x) = s_port(ssrc) And src_service(x) = s_service(ssrc) And src_database(x) = s_database(ssrc) Then
  129.                 Exit Sub
  130.             End If
  131.         Next x
  132.         src_port(src) = s_port(ssrc)
  133.         src_service(src) = s_service(ssrc)
  134.         src_database(src) = s_database(ssrc)
  135.         question_form.source_list.AddItem s_source_list.text
  136.     End If
  137. End Sub
  138. Sub src_add_Click ()
  139.     new_src_form.Show 1
  140. End Sub
  141. Sub src_change_Click ()
  142.     src = s_source_list.listindex
  143.     If src = -1 Then
  144.         Exit Sub
  145.     End If
  146.     new_src_form.s_add_title.text = s_source_list.text
  147.     port$ = Str$(s_port(src))
  148.     new_src_form.s_add_port.text = Right$(port$, Len(port$) - 1)
  149.     new_src_form.s_add_server.text = s_service(src)
  150.     new_src_form.s_add_database.text = s_database(src)
  151.     new_src_form.Show 1
  152.     If s_change_accepted Then
  153.         
  154.         For x = s_source_list.listindex To s_source_list.listcount
  155.             s_port(x) = s_port(x + 1)
  156.             s_service(x) = s_service(x + 1)
  157.             s_database(x) = s_database(x + 1)
  158.         Next x
  159.         s_source_list.RemoveItem s_source_list.listindex
  160.     End If
  161. End Sub
  162. Sub src_delete_Click ()
  163.     If s_source_list.listindex = -1 Then
  164.         MsgBox ("Please select a source to delete")
  165.         Exit Sub
  166.     End If
  167.     If MsgBox("     Are you sure?", 1) = 1 Then
  168.         For x = s_source_list.listindex To s_source_list.listcount
  169.             s_port(x) = s_port(x + 1)
  170.             s_service(x) = s_service(x + 1)
  171.             s_database(x) = s_database(x + 1)
  172.         Next x
  173.         
  174.         s_source_list.RemoveItem s_source_list.listindex
  175.     End If
  176. End Sub
  177. Sub src_use_Click ()
  178.     s_source_list_dblclick
  179. End Sub
  180.